package cn.tm.liu.mvc;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class ApplicationMain {

    public static void main(String[] args) {
        SpringApplication.run(ApplicationMain.class, args);
    }

    // 80端口跳转至443
    // @Bean
    // public Connector connector() {
    //     Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    //     connector.setScheme("http");
    //     connector.setPort(80);
    //     connector.setSecure(false);
    //     connector.setRedirectPort(443);
    //     return connector;
    // }

    // 80端口跳转至443
    // @Bean
    // public TomcatServletWebServerFactory tomcatServletWebServerFactory(Connector connector) {
    //     TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
    //         @Override
    //         protected void postProcessContext(Context context) {
    //             SecurityConstraint securityConstraint = new SecurityConstraint();
    //             securityConstraint.setUserConstraint("CONFIDENTIAL");
    //             SecurityCollection collection = new SecurityCollection();
    //             collection.addPattern("/*");
    //             securityConstraint.addCollection(collection);
    //             context.addConstraint(securityConstraint);
    //         }
    //     };
    //     tomcat.addAdditionalTomcatConnectors(connector);
    //     return tomcat;
    // }

    //Tomcat large file upload connection reset
    // mongodb存储大文件
    // @Bean
    // public TomcatServletWebServerFactory tomcatEmbedded() {
    //     TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
    //     tomcat.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> {
    //         if ((connector.getProtocolHandler() instanceof AbstractHttp11Protocol<
    //                 ?>)) {
    //             //-1 means unlimited
    //             ((AbstractHttp11Protocol<?>) connector.getProtocolHandler()).setMaxSwallowSize(-1);
    //         }
    //     });
    //     return tomcat;
    // }

}
